
<!DOCTYPE html>
<html lang="en-us">
<head>
  
  <meta charset="UTF-8" />
  <meta name="description" content="xorm readme" />
  <title>
    xorm 说明 | DenysG的个人博客
  </title>
  
  <meta name="viewport" content="width=device-width,user-scalable=no,maximum-scale=1,initial-scale=1">
  
  <link rel="canonical" href="https://48474.net/post/xorm-readme/"/>
  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
  
  <link rel="stylesheet" href="/css/sanitize.css">
  <link rel="stylesheet" href="/css/responsive.css">
  <link rel="stylesheet" href="/css/highlight_monokai.css">
  <link rel="stylesheet" href="/css/theme.css">
  <link rel="stylesheet" href="/css/custom.css">
  
  
  <link href="https://48474.net//index.xml" rel="alternate" type="application/rss+xml" title="DenysG的个人博客" />
  <link href="https://48474.net//index.xml" rel="feed" type="application/rss+xml" title="DenysG的个人博客" />

  
  

</head>



<body>
<div class="container">
  
  <header role="banner">
    <div class="row gutters">
      <div id="site-title" class="col span_6">
        <h1><a href="https://48474.net/">DenysG的个人博客</a></h1>
        <h2>我必须承认，幸运喜欢照顾勇敢的人。---- 达尔文</h2>
      </div>
      <div id="social" class="col span_6">
        <ul>
          
          
          <li><a href="https://github.com/cnphpbb/" target="_blank">GitHub</a></li>
          
        </ul>
      </div>
    </div>
  </header>


  
  <main id="single" role="main">
    <div class="article-header">
      <h1>xorm 说明</h1>
      <div class="meta">
        Oct 9, 2015 &nbsp;
        
          #<a href="/tags/xorm">xorm</a>&nbsp;
        
          #<a href="/tags/golang">golang</a>&nbsp;
        
          #<a href="/tags/guide">guide</a>&nbsp;
        
          #<a href="/tags/%E5%BC%80%E6%BA%90">开源</a>&nbsp;
        
      </div>
    </div>
    <article>
      <p>xorm是一个简单而强大的Go语言ORM库. 通过它可以使数据库操作非常简便。xorm的目标并不是让你完全不去学习SQL，我们认为SQL并不会为ORM所替代，但是ORM将可以解决绝大部分的简单SQL需求。xorm支持两种风格的混用。</p>
<h2 id="特性">特性</h2>
<ul>
<li>支持Struct和数据库表之间的灵活映射，并支持自动同步表结构</li>
<li>事务支持</li>
<li>支持原始SQL语句和ORM操作的混合执行</li>
<li>使用连写来简化调用</li>
<li>支持使用Id, In, Where, Limit, Join, Having, Table, Sql, Cols等函数和结构体等方式作为条件</li>
<li>支持级联加载Struct</li>
<li>支持LRU缓存(支持memory, memcache, leveldb, redis缓存Store) 和 Redis缓存</li>
<li>支持反转，即根据数据库自动生成xorm的结构体</li>
<li>支持事件</li>
<li>支持created, updated, deleted和version记录版本（即乐观锁）</li>
</ul>
<h2 id="驱动支持">驱动支持</h2>
<p>xorm当前支持的驱动和数据库如下：</p>
<ul>
<li>Mysql: <a href="https://github.com/go-sql-driver/mysql">github.com/go-sql-driver/mysql</a></li>
<li>MyMysql: <a href="https://github.com/ziutek/mymysql/godrv">github.com/ziutek/mymysql/godrv</a></li>
<li>SQLite: <a href="https://github.com/mattn/go-sqlite3">github.com/mattn/go-sqlite3</a></li>
<li>Postgres: <a href="https://github.com/lib/pq">github.com/lib/pq</a></li>
<li>MsSql: <a href="https://github.com/denisenkom/go-mssqldb">github.com/denisenkom/go-mssqldb</a></li>
<li>MsSql: <a href="https://github.com/lunny/godbc">github.com/lunny/godbc</a></li>
</ul>
<h2 id="安装">安装</h2>
<p>推荐使用 <a href="https://github.com/gpmgo/gopm">gopm</a> 进行安装：</p>
<pre><code>gopm get github.com/go-xorm/xorm
</code></pre>
<p>或者您也可以使用go工具进行安装：</p>
<pre><code>go get github.com/go-xorm/xorm
</code></pre>
<h2 id="文档">文档</h2>
<ul>
<li><a href="http://xorm.io/docs">操作指南</a></li>
<li><a href="http://gowalker.org/github.com/go-xorm/xorm">GoWalker代码文档</a></li>
<li><a href="http://godoc.org/github.com/go-xorm/xorm">Godoc代码文档</a></li>
</ul>
<h2 id="讨论">讨论</h2>
<p>请加入QQ群：280360085 进行讨论。</p>
<h2 id="贡献">贡献</h2>
<p>如果您也想为Xorm贡献您的力量，请查看 <a href="https://github.com/go-xorm/xorm/blob/master/CONTRIBUTING.md">CONTRIBUTING</a></p>
<h2 id="license">LICENSE</h2>
<p>BSD License
<a href="http://creativecommons.org/licenses/BSD/">http://creativecommons.org/licenses/BSD/</a></p>

      
      
      
    </article>
    


  </main>
  
  <nav class="pagination-single">
    
    
      <span class="next"><a href="https://48474.net/post/storage_knowledge/" rel="next">存储知识：比较在线、近线和离线存储</a> &rarr;</span>
    
  </nav>


  
  <footer role="contentinfo">
    <div style="text-align:center;">
      
      © 2020 135Get_Team. All rights reserved.
    </div>
  </footer>


</div>

<script src="/js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>



</body>
</html>

